<?php


/**
 * 参与竞拍Model
 * Enter description here ...
 * @author Admin
 *
 */
class ParticipateModel extends CommonModel {
	
	/**
	 * 获取某用户参与的竞拍数据
	 * Enter description here ...
	 * @param unknown_type $uid
	 * @param unknown_type $limit
	 */
	public function getAuctionData($uid,$limit){
		$map['P.uid'] = array('eq',$uid);
		$prefix = C('DB_PREFIX');
		$data = $this->Table("{$prefix}participate as P")->
					   join("{$prefix}auction as A on P.aid = A.id")->
					   where($map)->field('A.*')->
					   order('P.id desc')->limit($limit)->
					   findAll();
		return $data;
	}
	
	
	
	/**
	 * 获取某竞拍的参与用户数据
	 * Enter description here ...
	 * @param unknown_type $aid
	 * @param unknown_type $limit
	 */
	public function getUserData($aid,$limit){
		$map['P.aid'] = array('eq',$aid);
		$prefix = C('DB_PREFIX');
		$data = $this->Table("{$prefix}participate as P")->
					   join("{$prefix}user as U on P.uid = U.id")->
					   where($map)->field('U.*')->
					   order('P.id desc')->limit($limit)->
					   findAll();

		return $data;
	}
	
	
	
}
?>